package com.itany.controller;

import com.github.pagehelper.PageInfo;
import com.itany.book.service.SupplierService;
import com.itany.pojo.Supplier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@RequestMapping("/supplier")
public class SupplierController {

    @Autowired
    private SupplierService supplierService;

    @RequestMapping("/findSupplierAll")
    @ResponseBody
    public Map<String, Object> findSupplierAll(Integer page, Integer rows){
        PageInfo<Supplier> supplierPages = supplierService.findSupplierAll(page, rows);
        HashMap<String, Object> map = new HashMap<>();
        map.put("total",supplierPages.getTotal());
        map.put("rows",supplierPages.getList());
        return map;
    }

}
